Page({
  data: {
    swiper: ['https://img0.baidu.com/it/u=520838957,128907938&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333','https://img0.baidu.com/it/u=1943829366,3409206424&fm=253&fmt=auto&app=138&f=JPEG?w=807&h=500','https://img1.baidu.com/it/u=3035835753,3491796325&fm=253&fmt=auto&app=138&f=JPEG?w=784&h=500'],
    TabCur: 0,
    scrollLeft: 0,
    placeList: [],
    newsList: [{
      "title": "矢量插画师：通过摄影作品学习建筑的空间语言",
      "user": "飞屋瑞",
      "date": "2019-05-12",
      "collection": 97,
      "url": "https://image.meiye.art/Fha6tqRTIwHtlLW3xuZBJj8ZXSX3?imageMogr2/thumbnail/450x/interlace/1"
    }, {
      "title": "微信大改版之UI设计分析！分析点啥？",
      "user": "moxiao",
      "date": "2019-05-12",
      "collection": 21,
      "url": "https://image.meiye.art/FhHGe9NyO0uddb6D4203jevC_gzc?imageMogr2/thumbnail/450x/interlace/1"
    }, {
      "title": "如何合理创建间距系统，来更快地实现设计方案？",
      "user": "毒眸",
      "date": "2019-05-12",
      "collection": 17,
      "url": "https://image.meiye.art/FlqKg5bugFQD5Qzm_QhGM7ET4Mtx?imageMogr2/thumbnail/450x/interlace/1"
    }, {
      "title": "百度如何成为小程序生态的最大变量？",
      "user": "罗超频道",
      "date": "2019-05-12",
      "collection": 23,
      "url": "https://image.meiye.art/Fha6tqRTIwHtlLW3xuZBJj8ZXSX3?imageMogr2/thumbnail/450x/interlace/1"
    }, ]
  },
  torouter(e){
    wx.navigateTo({
      url: '../router/router',
    })
  },
  tosearch() {
    wx.navigateTo({
      url: '../searchpage/searchpage',
    })
  },
  toallplace() {
    wx.navigateTo({
      url: '../tjdingzhi/tjdingzhi',
    })
  },
  onLoad() {

  },
  //点击景点之后跳转到详情页
  todetail(e) {
    console.log(e)
    var id = e.currentTarget.dataset.index
    wx.navigateTo({
      url: '../placedetail/placedetail?id=' + id,
    })
  },
  onShow() {
    var phone = wx.getStorageSync('phone')
    if (!phone) {
      wx.navigateTo({
        url: '../login/login',
      })
    }
    this.getplace() //获取景区信息
  },
  getplace() {
    wx.cloud.callFunction({
      name: 'getplacelistbynum'
    }).then(res => {
      console.log(res)
      this.setData({
        placeList: res.result.data.reverse()
      })
    })
  },
  tabSelect(e) {
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id - 1) * 60
    })
  }
})